import type { MembershipPlan, WordPlan, RechargeOrder } from './types';

// 会员套餐模拟数据
export const mockMembershipPlans: MembershipPlan[] = [
  {
    id: 1,
    name: '基础月卡会员',
    originalPrice: 99,
    currentPrice: 79,
    features: ['200万字', '在线搜图', '在线知识库'],
    type: 'basic_monthly',
    tag: '入门畅享'
  },
  {
    id: 2,
    name: '标准月卡会员',
    originalPrice: 199,
    currentPrice: 159,
    features: ['在线搜图、在线知识库', '建立标书风格', '专属客服、响应评分', '10家订阅企业'],
    type: 'pro_monthly',
    tag: '热门推荐',
    isBest: true
  },
  {
    id: 3,
    name: '基础年卡会员',
    originalPrice: 998,
    currentPrice: 798,
    features: ['每月200万字','在线搜图、在线知识库', '建立标书风格', '专属客服、响应评分'],
    type: 'basic_yearly',
    tag: '长期优选'
  },
  {
    id: 4,
    name: '标准年卡会员',
    originalPrice: 1998,
    currentPrice: 1598,
    features: ['在线搜图、在线知识库、建立标书风格', '专属客服、响应评分', '无限订阅企业、招标讯息优先查看、投标同行查看'],
    type: 'pro_yearly',
    tag: '尊享特权'
  }
];

// 字数套餐模拟数据
export const mockWordPlans: WordPlan[] = [
  {
    id: 5,
    words: 10000,
    originalPrice: 29,
    currentPrice: 19,
    mostUsed: false
  },
  {
    id: 6,
    words: 50000,
    originalPrice: 99,
    currentPrice: 89,
    mostUsed: true
  },
  {
    id: 7,
    words: 100000,
    originalPrice: 179,
    currentPrice: 159,
    mostUsed: false
  },
  {
    id: 8,
    words: 500000,
    originalPrice: 699,
    currentPrice: 599,
    mostUsed: false
  }
];

// 模拟二维码图片
export const mockQrCode = {
  wechat: 'https://qny.sunne.xyz/static/img/kmm/qrcode-wechat.png',
  alipay: 'https://qny.sunne.xyz/static/img/kmm/qrcode-alipay.png'
};

// 模拟创建订单
export const createMockOrder = (planId: number, paymentMethod: 'wechat' | 'alipay'): RechargeOrder => {
  const plan = [...mockMembershipPlans, ...mockWordPlans].find((p) => p.id === planId);
  const price = plan ? plan.currentPrice : 0;

  return {
    orderId: `ORD${Date.now()}`,
    qrCodeUrl: paymentMethod === 'wechat' ? mockQrCode.wechat : mockQrCode.alipay,
    expireTime: new Date(Date.now() + 15 * 60 * 1000).toISOString(), // 15分钟后过期
    amount: price,
    status: 'unpaid'
  };
};

// 模拟用户充值记录
export const mockRechargeRecords = [
  {
    id: 1,
    orderNo: 'ORD202405120001',
    planName: '专业月度会员',
    amount: 159,
    paymentMethod: 'wechat',
    status: 'success',
    createTime: '2024-05-12 14:23:45'
  },
  {
    id: 2,
    orderNo: 'ORD202405050002',
    planName: '50000字套餐',
    amount: 89,
    paymentMethod: 'alipay',
    status: 'success',
    createTime: '2024-05-05 10:15:30'
  },
  {
    id: 3,
    orderNo: 'ORD202404200003',
    planName: '标准月度会员',
    amount: 79,
    paymentMethod: 'wechat',
    status: 'success',
    createTime: '2024-04-20 16:42:12'
  }
];
